package com.harmontronics.hanma.paas.paas.domain.app.entity;

import cn.hutool.core.collection.CollectionUtil;
import com.harmontronics.hanma.paas.paas.domain.app.entity.valueobject.AuthTypeEnum;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 第三方服务
 *
 * @author paas-generator
 * @email paas-generator@harmontronics.com
 * @date 2021-05-17 11:29:08
 */
@Data
public class HmHttpService {

    /**
     * $column.comments
     */
    private Long id;
    /**
     * 服务KEY
     */
    private String key;
    /**
     * 服务名称
     */
    private String name;
    /**
     * 描述
     */
    private String remark;
    /**
     * 认证方式
     */
    private AuthTypeEnum authType;
    /**
     * 创建时间
     */
    private LocalDateTime createDate;
    /**
     * 创建人
     */
    private String createBy;
    /**
     * 修改时间
     */
    private LocalDateTime modifyDate;
    /**
     * 修改人
     */
    private String modifyBy;


    private List<HttpServiceSetting>  settingList;


    public void checkMosParam(){
        if(this.authType != AuthTypeEnum.MOS){
            return;
        }
        if(CollectionUtil.isEmpty(settingList)){
            return;
        }
        for(HttpServiceSetting serviceSetting:settingList){
            serviceSetting.getMosParamAndCheck();
        }
    }

}
